package com.datastructure.test.maxlengthofchildserial;

import java.util.ArrayList;
import java.util.Comparator;

public class MaxLengthOfChildSerial {

    ArrayList<String> dataList = new ArrayList<>();
    StringBuilder stringBuilder = new StringBuilder();
    public static void main(String[] args) {
        String s1 = "1A2C3D4B56";
        String s2 = "B1D23A456A";
        MaxLengthOfChildSerial maxLengthOfChildSerial = new MaxLengthOfChildSerial();
        maxLengthOfChildSerial.LCS(s1,s2);
    }

    public String LCS (String s1, String s2) {
        // write code here
        int[][] data = new int[s1.length()][s2.length()];
        byte[] bytes = s1.getBytes();
        byte[] bytes1 = s2.getBytes();
        for (int i = 0; i < bytes.length; i++) {
            for (int j = 0; j < bytes1.length; j++) {
                if(bytes[i]==bytes1[j]){
                    data[i][j] = 1;
                }
            }
        }
        dfs(data, bytes.length-1, bytes1.length-1,s1);
        dataList.stream().sorted(Comparator.comparingInt(String::length));
        System.out.println(dataList.get(dataList.size()-1));
        return dataList.get(0);
    }

    public void dfs(int[][] data,int i,int j,String s1){

    }
}
